package com.googlecode.imanager.jasper.print;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class RInsets implements Cloneable {
    
    private int left;
    private int top;
    private int right;
    private int bottom;

    public int getLeft() {
        return left;
    }

    public void setLeft(int left) {
        this.left = left;
    }

    public int getTop() {
        return top;
    }

    public void setTop(int top) {
        this.top = top;
    }

    public int getRight() {
        return right;
    }

    public void setRight(int right) {
        this.right = right;
    }

    public int getBottom() {
        return bottom;
    }

    public void setBottom(int bottom) {
        this.bottom = bottom;
    }
    
    public int getHorizontal(){
        return left + right;
    }
        
    public int getVertical(){
        return top + bottom;
    }
        
    public static final RInsets EMPTY_INSETS = new RInsets(){

        @Override
        public void setBottom(int bottom) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void setLeft(int left) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void setRight(int right) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void setTop(int top) {
            throw new UnsupportedOperationException();
        }

        @Override
        public RInsets clone() {
            return this;
        }
        
    };

    @Override
    public RInsets clone() {
        try {
            return (RInsets) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }
    
}
